<template>
    <transition name="el-zoom-in-bottom">
        <div class="right" v-show="expandR">
            <div class="main">
                <el-card class="box-card">
                    <template #header>
                        <div class="card-header">
                            <span>名称：{{ sl(emitEditor.info?.currentModel?.name) }}</span>
                        </div>
                    </template>
                    <div class="text item" v-for="i in ['x', 'y', 'z']">{{
                            '坐标 ' + i + ' : ' +
                            sl(emitEditor.info?.point[i])
                        }}
                    </div>
                    <template #footer>
                        <el-button class="button" @click="emitEditor.threeEditor.setLight('AmbientLight', { intensity: 3 })" text>快速添加环境光
                        </el-button>
                    </template>
                </el-card>
                <br/>
            </div>
        </div>
    </transition>
    <div class="expand-show" :style="{ right: !expandR ? '0px' : '240px' }">
        <el-icon class="icon" @click="expandR = !expandR">
            <Expand v-if="!expandR"/>
            <Fold v-else/>
        </el-icon>
    </div>
</template>
<script setup>
import {ref} from 'vue';

const props = defineProps(['emitEditor']);

function sl(i) {
    if (!i) return '';
    if (typeof i === 'number') return i.toFixed(12)
    else return i.slice(0, 12);

}
const expandR = ref(true);
</script>
<style lang="less" scoped>
.right {
    width: 240px;
    height: calc(100% - 50px); // 50px是顶部导航栏的高度
    background-color: #181818;
    position: fixed;
    top: 50px;
    right: 0;
    z-index: 100;
    overflow: auto;
    display: flex;
    .main {
        width: 100%;
        height: 100%;
        padding: 8px;
        box-sizing: border-box;
    }
}
.expand-show {
    position: absolute;
    bottom: 15px;
    z-index: 101;
    background-color: #181818;
    right: 240px;
    height: 30px;
    border-radius: 3px 0px 0px 3px;
    .icon {
        font-size: 30px;
        color: #fff;
        cursor: pointer;
        transition: all 0.8s;
        &:hover {
            transform: rotate(180deg);
        }
    }
}
</style>
